package com.zzp.zjs_bos.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zzp.zjs_bos.dao.IFunctionDao;
import com.zzp.zjs_bos.domain.Function;
import com.zzp.zjs_bos.domain.User;
import com.zzp.zjs_bos.service.IFunctionService;

@Service
@Transactional
public class FunctionServiceImpl implements IFunctionService {

	@Resource
	protected IFunctionDao functionDao;
	
	public List<Function> findAll() {
		return functionDao.findAll();
	}

	public List<Function> findByUser(User user) {
		if("admin".equals(user.getUsername())){
			return functionDao.findAllMenu();
		}else{
			
			return functionDao.findMenuByUserId(user.getId());
		}
	}

}
